{% macro display_all_domains(managedDomains=[], allDomains=[]) -%}
<div class="columns clear">
    <div class="col2-3">
        <div class="form-field clear">
            <h4 class="size-250 fl-space">{{ _('Managed Domains') }}</h4>
            <div class="checklist clear">
                <fieldset>
                    {% for r in allDomains %}
                        {% set domain = r.domain |e %}
                        <div class="clear">
                            <div class="checklist-item">
                                <span class="fl-space">
                                    <input type="checkbox" name="domainName" value="{{ domain }}" {% if domain in managedDomains %}checked{%endif%} />
                                </span>
                                <label>
                                    {% if r.description |length > 0 %}
                                        {{ domain }} ({{ r.description |cutString |e }})
                                    {% else %}
                                        {{ domain }}
                                    {% endif %}
                                </label>
                            </div>
                        </div>
                    {% endfor %}
                </fieldset>
            </div>
        </div>
    </div>{#-- .col2-3 --#}

    <div class="col1-3 lastcol">
        <div class="mark_blue bt-space10">
            <ul class="standard clean-padding bt-space10">
                <li class="bt-space5"><a href="{{ctx.homepath}}/create/domain" class="action_add">{{ _('Add domain') }}</a></li>
            </ul>
        </div>
    </div>
</div>{#-- .columns --#}
{%- endmacro %}

{% macro display_all_admins(domainAdmins=[], allAdmins=[]) -%}
    <div class="form-field clear">
        <h4 class="size-250 fl-space">{{ _('Domain Admins') }}</h4>
        <div class="checklist clear">
            <fieldset>
            {% for admin in allAdmins %}
                {% set username = admin.username |e %}
                <div class="clear">
                    <div class="checklist-item">
                        <span class="fl-space"><input type="checkbox" name="domainAdmin" value="{{ username }}" {% if username in domainAdmins %}checked{%endif%} class="checkbox" rel="checkboxhorizont" /></span>
                        <label>
                            {% if admin.name not in ['', none,] %}
                                {{ admin.name |e }}
                            {% else %}
                                {{ username.split('@',1)[0] }}
                            {% endif %}
                            (<a href="{{ctx.homepath}}/profile/admin/general/{{ username }}" target="_blank">{{ username }}</a>)
                        </label>
                    </div>
                </div>
            {% endfor %}
            </fieldset>
        </div>
    </div>
{%- endmacro %}

